package com.game.message.task;


import com.game.message.Msg;
import com.game.message.connetion.ConnectionManager;
import com.game.message.pb.PBMessage;
import io.netty.channel.ChannelHandlerContext;

public abstract class AbstractProcessor implements IProcessor {
	public Msg process(Msg msg, ChannelHandlerContext ctx) throws Exception {
		Integer userId = (Integer) ctx.attr(ConnectionManager.userIdAttributeKey).get();
		if (userId == 0) {
			throw new Exception("用户没有登录，不能操作");
		}
		return process(msg,userId);
	}
	public abstract PBMessage process(Msg msg, int userId);
}
